//package com.zzyl.nursing.service.impl;
//
//import java.util.Arrays;
//import java.util.Collection;
//import java.util.List;
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.zzyl.common.utils.DateUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.zzyl.nursing.mapper.NursingProjectMapper;
//import com.zzyl.nursing.domain.NursingProject;
//import com.zzyl.nursing.service.INursingProjectService;
//
///**
// * 护理项目Service业务层处理
// *
// * @author ruoyi
// * @date 2025-10-07
// */
//@Service
//public class NursingProjectServiceImpl extends ServiceImpl<NursingProjectMapper,NursingProject> implements INursingProjectService
//{
//    @Autowired
//    private NursingProjectMapper nursingProjectMapper;
//
//    /**
//     * 查询护理项目
//     *
//     * @param id 护理项目主键
//     * @return 护理项目
//     */
//    @Override
//    public NursingProject selectNursingProjectById(Long id)
//    {
////        return nursingProjectMapper.selectNursingProjectById(id);
//        return getById(id);
//    }
//
//    /**
//     * 查询护理项目列表
//     *
//     * @param nursingProject 护理项目
//     * @return 护理项目
//     */
//    @Override
//    public List<NursingProject> selectNursingProjectList(NursingProject nursingProject)
//    {
//        return nursingProjectMapper.selectNursingProjectList(nursingProject);
//    }
//
//    /**
//     * 新增护理项目
//     *
//     * @param nursingProject 护理项目
//     * @return 结果
//     */
//    @Override
//    public int insertNursingProject(NursingProject nursingProject)
//    {
//        nursingProject.setCreateTime(DateUtils.getNowDate());
////        return nursingProjectMapper.insertNursingProject(nursingProject);
//        return save(nursingProject) ? 1 : 0 ;
//    }
//
//    /**
//     * 修改护理项目
//     *
//     * @param nursingProject 护理项目
//     * @return 结果
//     */
//    @Override
//    public int updateNursingProject(NursingProject nursingProject)
//    {
//        nursingProject.setUpdateTime(DateUtils.getNowDate());
////        return nursingProjectMapper.updateNursingProject(nursingProject);
//        return updateById(nursingProject) ? 1 : 0 ;
//    }
//
//    /**
//     * 批量删除护理项目
//     *
//     * @param ids 需要删除的护理项目主键
//     * @return 结果
//     */
//    @Override
//    public int deleteNursingProjectByIds(Long[] ids)
//    {
////        return nursingProjectMapper.deleteNursingProjectByIds(ids);
//        //这里参数是集合,需要转换,返回值为布尔值,需要转换为int
//        return removeByIds(Arrays.asList(ids)) ? 1 : 0 ;
//    }
//
//    /**
//     * 删除护理项目信息
//     *
//     * @param id 护理项目主键
//     * @return 结果
//     */
//    @Override
//    public int deleteNursingProjectById(Long id)
//    {
////        return nursingProjectMapper.deleteNursingProjectById(id);
//        return removeById(id) ? 1 : 0 ;
//    }
//}
package com.zzyl.nursing.service.impl;

import java.util.List;

import com.zzyl.nursing.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zzyl.nursing.mapper.NursingProjectMapper;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;

/**
 * 护理项目Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-10
 */
@Service
public class NursingProjectServiceImpl extends ServiceImpl<NursingProjectMapper, NursingProject> implements INursingProjectService
{
    @Autowired
    private NursingProjectMapper nursingProjectMapper;

    /**
     * 查询护理项目
     *
     * @param id 护理项目主键
     * @return 护理项目
     */
    @Override
    public NursingProject selectNursingProjectById(Long id)
    {
        return getById(id);
    }

    /**
     * 查询护理项目列表
     *
     * @param nursingProject 护理项目
     * @return 护理项目
     */
    @Override
    public List<NursingProject> selectNursingProjectList(NursingProject nursingProject)
    {
        return nursingProjectMapper.selectNursingProjectList(nursingProject);
    }

    /**
     * 新增护理项目
     *
     * @param nursingProject 护理项目
     * @return 结果
     */
    @Override
    public int insertNursingProject(NursingProject nursingProject)
    {
        return save(nursingProject)? 1 : 0;
    }

    /**
     * 修改护理项目
     *
     * @param nursingProject 护理项目
     * @return 结果
     */
    @Override
    public int updateNursingProject(NursingProject nursingProject)
    {
        return updateById(nursingProject)? 1 : 0;
    }

    /**
     * 批量删除护理项目
     *
     * @param ids 需要删除的护理项目主键
     * @return 结果
     */
    @Override
    public int deleteNursingProjectByIds(Long[] ids)
    {
        return removeByIds(Arrays.asList(ids))? 1 : 0;
    }

    /**
     * 删除护理项目信息
     *
     * @param id 护理项目主键
     * @return 结果
     */
    @Override
    public int deleteNursingProjectById(Long id)
    {
        return removeById(id)? 1 : 0;
    }

    /**
     * 查询所有护理项目
     *
     * @return
     */
    @Override
    public List<NursingProjectVo> all() {
        return nursingProjectMapper.all();
    }
}
